home *** CD-ROM | disk | FTP | other *** search
- global gholdTheFTword, gBeginCurlyQ, gEndCurlyQ, oIndexSlider, gStashedSEEList
-
- on hIsaQuote pChar
- set pChar to charToNum(pChar)
- if (pChar = 39) or (pChar = 34) or (pChar = charToNum(gBeginCurlyQ)) then
- return 1
- else
- return 0
- end if
- end
-
- on hIsaCastMem pName
- if the number of cast pName < 0 then
- return 0
- else
- return 1
- end if
- end
-
- on hIsaRomanDate pNtry
- set lx to value(char 1 to 4 of pNtry)
- if lx = EMPTY then
- return 0
- end if
- if (lx >= 1800) and (lx <= 2400) then
- return 1
- else
- return 0
- end if
- end
-
- on hPhraseEndsWith pPhrase, pWord
- set Lnum to the number of words in pPhrase
- if word Lnum of pPhrase = pWord then
- return 1
- else
- return 0
- end if
- end
-
- on hGetLastWord pPhrase
- set Lnum to the number of words in pPhrase
- return word Lnum of pPhrase
- end
-
- on hWordEndsWith pWord, pChar
- set Lnum to the number of chars in pWord
- if char Lnum of pWord = pChar then
- return 1
- else
- return 0
- end if
- end
-
- on hLastNameFirst pTheEntry
- hReportStatus("No immediate match. Altering search parameters...")
- set vNum to the number of words in pTheEntry
- if vNum > 1 then
- set vLastWord to word vNum of pTheEntry
- if word 2 of pTheEntry = "La" then
- set pTheEntry to word 2 to vNum of pTheEntry & ", " & word 1 of pTheEntry
- else
- set vFirstWords to word 1 to vNum - 1 of pTheEntry
- set pTheEntry to vLastWord & ", " & vFirstWords
- set vhold to word the number of words in pTheEntry of pTheEntry
- set vhold to hZapEnd(vhold, 32)
- set pTheEntry to word 1 to vNum - 1 of pTheEntry & " " & vhold
- end if
- end if
- return pTheEntry
- end
-
- on hIsADoctor pTheEntry
- hReportStatus("No immediate match. Altering search parameters...")
- hSayProgress(#WOR)
- set vNum to the number of words in pTheEntry
- if vNum > 1 then
- set vLastWord to word vNum of pTheEntry
- set vFirstWords to word 1 to vNum - 1 of pTheEntry
- set pTheEntry to vLastWord & ", " & vFirstWords
- set vhold to word the number of words in pTheEntry of pTheEntry
- set vhold to hZapEnd(vhold, 32)
- set pTheEntry to word 1 to vNum - 1 of pTheEntry & " Dr. " & vhold
- end if
- return pTheEntry
- end
-
- on hTryCap pTheEntry
- hReportStatus("No immediate match. Altering search parameters...")
- put hCapitalize(char 1 of word 1 of pTheEntry) into char 1 of word 1 of pTheEntry
- return pTheEntry
- end
-
- on hTryHarder pTheEntry
- global gComputerTypeK
- hReportStatus("No immediate match. Altering search parameters...")
- set Lnum to the number of words in pTheEntry
- if hWordEndsWith(word Lnum of pTheEntry, "s") then
- set Llastchar to the number of chars in word Lnum of pTheEntry
- delete char Llastchar of word Lnum of pTheEntry
- end if
- if hWordEndsWith(word Lnum of pTheEntry, "'") then
- set Llastchar to the number of chars in word Lnum of pTheEntry
- delete char Llastchar of word Lnum of pTheEntry
- end if
- if gComputerTypeK = #mac then
- set curlyOffset to offset(numToChar(213), pTheEntry)
- set numOfChars to the number of chars in pTheEntry
- if curlyOffset > 0 then
- set pTheEntry to char 1 to curlyOffset - 1 of pTheEntry & "'" & char curlyOffset + 1 to numOfChars of pTheEntry
- end if
- end if
- return pTheEntry
- end
-
- on htryevenharder pTheEntry
- end
-
- on hTweaktoTitle pChars
- if hIsaQuote(char 1 of pChars) then
- put numToChar(210) into char 1 of pChars
- else
- put numToChar(210) before pChars
- end if
- return pChars
- end
-
- on htransposearticles pWords
- if the number of words in pWords > 1 then
- set lFirst to word 1 of pWords
- if ((lFirst contains "The") and (length(lFirst) <= 4)) or ((char 2 of lFirst = "A") and (length(lFirst) = 2)) then
- set Lnum to the number of words in pWords
- if lFirst starts gBeginCurlyQ then
- set Linit to gBeginCurlyQ
- delete char 1 of lFirst
- set Lend to the number of chars in word Lnum of pWords
- delete char Lend of word Lnum of pWords
- set Lfinal to gEndCurlyQ
- else
- set Linit to EMPTY
- set Lfinal to EMPTY
- end if
- set Lnew to Linit & word 2 to Lnum of pWords & ", " & lFirst & Lfinal
- return Lnew
- end if
- end if
- return pWords
- end
-
- on hcleanup x
- if voidp(x) then
- return
- end if
- repeat while char 1 of x = " "
- delete char 1 of x
- end repeat
- repeat while char length(x) of x = " "
- delete char length(x) of x
- end repeat
- set vItemsToStrip to " ,.()[]/\!?" & QUOTE & "”"
- if vItemsToStrip contains char 1 of x then
- delete char 1 of x
- end if
- set y to length(x)
- set vFound to 1
- repeat while vFound = 1
- if vItemsToStrip contains char y of x then
- delete char y of x
- set y to y - 1
- next repeat
- end if
- set vFound to 0
- end repeat
- if QUOTE & "“" contains char 1 of x then
- delete char 1 of x
- end if
- return x
- end
-
- on hStripTrailingReturns pPhrase
- set Lsize to the number of chars in pPhrase
- set Llimit to Lsize - 5
- repeat with n = Lsize down to Llimit
- if charToNum(char n of pPhrase) = 13 then
- delete char n of pPhrase
- end if
- end repeat
- repeat while charToNum(char length(pPhrase) of pPhrase) = 32
- delete char length(pPhrase) of pPhrase
- end repeat
- if charToNum(char length(pPhrase) of pPhrase) = 46 then
- delete char length(pPhrase) of pPhrase
- end if
- return pPhrase
- end
-
- on hIsaSeeListItem pTheword, pThechunk
- if not (pThechunk contains ";") then
- return(void)
- else
- set Lthisword to pTheword
- if Lthisword contains ";" then
- set Lthisword to char 1 to length(Lthisword) - 1 of Lthisword
- end if
- set tidl to the itemDelimiter
- set the itemDelimiter to ";"
- set z to the number of items in pThechunk
- repeat with i = 1 to z
- set Ltempstr to item i of pThechunk
- if Ltempstr contains Lthisword then
- set the itemDelimiter to tidl
- return Ltempstr
- exit repeat
- end if
- end repeat
- set the itemDelimiter to tidl
- return(void)
- end if
- end
-
- on hCompileSEEtoFound pTheWordNum, pthefield
- hReportStatus("Compiling related entries from SEE list...")
- set pThechunk to hExtractSeeList(pTheWordNum, pthefield)
- set tidl to the itemDelimiter
- set the itemDelimiter to ";"
- set z to the number of items in pThechunk
- set Ltemplist to [:]
- repeat with i = 1 to z
- set LanNtry to item i of pThechunk
- if char 1 of LanNtry = " " then
- delete char 1 of LanNtry
- end if
- if LanNtry <> EMPTY then
- setaProp(Ltemplist, LanNtry, [])
- end if
- end repeat
- set the itemDelimiter to tidl
- hSwitchFTsearchscope(#ENCY)
- hSetMode(#FoundSet)
- set gStashedSEEList to Ltemplist
- mSetupSEEList(oIndexScroller)
- set kall to mGetThisEntryName(oIndexMediator, #FoundSet, 1, 1)
- mReDefineSlider(oIndexSlider, 1, z - 6, 1)
- mSetSlider(oIndexSlider, 1)
- set k to char 1 of kall
- hSetIndex(k, kall)
- hProcess(kall)
- end
-
- on hExtractSeeList pTheWordNum, pthefield
- global gkeylist, gKeyCount, gTheFTword
- sort(gkeylist)
- set Lpointer to findPosNear(gkeylist, pTheWordNum)
- set Lstylehere to getAt(getAt(gkeylist, Lpointer), 2)
- if (Lstylehere = #b) or (Lstylehere = #bi) then
- else
- set Lpointer to Lpointer + 1
- set Lstylehere to getAt(getAt(gkeylist, Lpointer), 2)
- if (Lstylehere = #b) or (Lstylehere = #bi) then
- else
- beep()
- abort()
- end if
- end if
- set Lchunkstart to getPropAt(gkeylist, Lpointer)
- set Lnumofwords to 0
- repeat with i = Lpointer to gKeyCount
- set Lastyle to getAt(getAt(gkeylist, i), 2)
- if (Lastyle = #b) or (Lastyle = #bi) then
- set Lchunkend to getPropAt(gkeylist, i)
- set Lnumofwords to Lnumofwords + getAt(getAt(gkeylist, i), 1)
- next repeat
- end if
- exit repeat
- end repeat
- if Lchunkend < Lchunkstart then
- beep()
- abort()
- end if
- set Ltheblock to word Lchunkstart to Lchunkstart + Lnumofwords of field pthefield
- set gTheFTword to "[" & line 1 of field pthefield & "]"
- return hStripTrailingReturns(Ltheblock)
- end
-